﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Menu.aspx.cs" Inherits="www.Admin.Menu" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Import Namespace="www.Controllers" %>
<%@ Import Namespace="www.Core.Contract.DataContract" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

        function CheckAllEmp(checkbox) {
            var gridVwHeaderChckbox = document.getElementById("<%=grid_menu.ClientID %>");
            for (i = 1; i < gridVwHeaderChckbox.rows.length; i++) {
                gridVwHeaderChckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = checkbox.checked;
            }
        }
        function CheckAllLanguage(checkbox) {
            var gridVwHeaderChckbox = document.getElementById("<%=grvNgonngu.ClientID %>");
            for (i = 1; i < gridVwHeaderChckbox.rows.length; i++) {
                gridVwHeaderChckbox.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = checkbox.checked;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div class="title">
        QUẢN LÝ MENU
    </div>
    <div class="clear">
    </div>
    <div id="pnwrapView" runat="server">
        <div class="rows">
            <div class="ColLeft">
                <span>Loại Menu:</span>
            </div>
            <div class="ColRight">
                <asp:DropDownList ID="ddlTypeMenu" runat="server" CssClass="combobox" AutoPostBack="True" OnSelectedIndexChanged="ddlTypeMenu_SelectedIndexChanged">
                    <asp:ListItem Value="1">Menu Client</asp:ListItem>
                    <asp:ListItem Value="2">Menu Admin</asp:ListItem>
                </asp:DropDownList>
            </div>
        </div>
        <div class="clear">
        </div>
        <div id="pnview" runat="server">
            <div class="frame">
                <div class="table">
                    <img src="../Design/Icon/icon/add.png" class="control" />
                    <asp:LinkButton ID="lbtinsert1" runat="server" OnClick="lbtInsert_Click">Thêm Mới</asp:LinkButton>
                    <img src="../Design/Icon/icon/desc.gif" class="control" />
                    <asp:LinkButton ID="lbtord1" runat="server" OnClick="lbtOrder_Click">Sắp Xếp</asp:LinkButton>
                    <img src="../Design/Icon/icon/refresh.png" class="control" />
                    <asp:LinkButton ID="lbtrefresh1" runat="server" OnClick="lbtrefresh_Click">Làm Tươi</asp:LinkButton>
                    <img src="../Design/Icon/icon/uplevel.png" class="control" />
                    <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở Lại</a>
                </div>
                <div>
                    <asp:GridView ID="grid_menu" runat="server" AutoGenerateColumns="False" BackColor="White"
                        BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" Width="100%" AllowPaging="True"
                        PageSize="30" ShowHeaderWhenEmpty="True" OnRowCommand="grid_advertise_RowCommand" OnPageIndexChanging="grid_advertise_PageIndexChanging" OnRowDataBound="grid_menu_RowDataBound">
                        <Columns>
                            <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="lblid" runat="server" Text='<%#Eval("Id") %>'></asp:Label>
                                    <asp:Label ID="lbltype" runat="server" Text='<%#Eval("Type") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Tên</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Name") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Danh mục</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblCategoryId" runat="server" Text='<%# Eval("CategoryId") %>' Visible="False"></asp:Label>
                                    <asp:Label ID="lblCategoryName" runat="server" Text=""></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Menu Cha</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblParent" runat="server" Text='<%# Eval("Parent") %>' Visible="False"></asp:Label>
                                    <asp:Label ID="lblParentDisplay" runat="server" Text=""></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Liên Kết</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Link") %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Thứ Tự</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Eval("Ord") %>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Trạng Thái</HeaderTemplate>
                                <ItemTemplate>
                                    <%# Utilities.Active(Convert.ToInt32(Eval("Active"))) %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>Thao Tác</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:ImageButton ID="ibtedit" runat="server" CommandName="cmd_edit" CommandArgument='<%#Eval("Id") %>'
                                        ToolTip='Sửa' CssClass="business" ImageUrl="../Design/Icon/icon/edit.png" />
                                    <asp:ImageButton ID="ibtdel" runat="server" ToolTip='Xóa' CssClass="business" CommandName="cmd_delete"
                                        CommandArgument='<%#Eval("Id") %>' ImageUrl="../Design/Icon/icon/delete.png" />
                                    <asp:ImageButton ID="ibtactive" runat="server" CommandName="cmd_active" CommandArgument='<%#Eval("Id") %>'
                                        ToolTip='<%#Utilities.TooltipActive(Convert.ToInt32(Eval("Active"))) %>' CssClass="business" ImageUrl="../Design/Icon/icon/stop1.png" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" Width="16%"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                        <RowStyle BackColor="White" ForeColor="#003399" />
                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <SortedAscendingCellStyle BackColor="#EDF6F6" />
                        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                        <SortedDescendingCellStyle BackColor="#D6DFDF" />
                        <SortedDescendingHeaderStyle BackColor="#002876" />
                    </asp:GridView>
                </div>
                <div class="table">
                    <img src="../Design/Icon/icon/add.png" class="control" />
                    <asp:LinkButton ID="lbtInsert2" runat="server" OnClick="lbtInsert_Click">Thêm Mới</asp:LinkButton>
                    <img src="../Design/Icon/icon/desc.gif" class="control" />
                    <asp:LinkButton ID="lbtord2" runat="server" OnClick="lbtOrder_Click">Sắp Xếp</asp:LinkButton>
                    <img src="../Design/Icon/icon/refresh.png" class="control" />
                    <asp:LinkButton ID="lbtrefress2" runat="server" OnClick="lbtrefresh_Click">Làm Tươi</asp:LinkButton>
                    <img src="../Design/Icon/icon/uplevel.png" class="control" />
                    <a href="javascript:void(0);" onclick="window.history.go(-1);">Trở Lại</a>
                </div>
            </div>
        </div>

        <div id="pnposition" runat="server" visible="false">
            <div class="table">
                <img src="../Design/Icon/icon/page_save.png" class="control" />
                <asp:LinkButton ID="lbtsave3" runat="server" OnClick="lbtSave_Click">Lưu</asp:LinkButton>
                <img src="../Design/Icon/icon/back.png" class="control" />
                <asp:LinkButton ID="lbtback3" runat="server" OnClick="lbtback_Click">Trở Lại</asp:LinkButton>
            </div>
            <div class="frame">
                <div class="rows">
                    <div class="ColLeft">
                        <span>Tên Menu:</span>
                    </div>
                    <div class="ColRight">
                        <select id="ddlmenu" class="combobox" runat="server"></select>
                    </div>
                </div>
                <div class="rows">
                    <div class="ColLeft">
                        <span>Thứ tự:</span>
                    </div>
                    <div class="ColRight">
                        <input type="text" class="textbox" runat="server" id="txtord2" />
                    </div>
                </div>
            </div>
            <div class="table">
                <img src="../Design/Icon/icon/page_save.png" class="control" />
                <asp:LinkButton ID="lbtsave4" runat="server" OnClick="lbtSave_Click">Lưu</asp:LinkButton>
                <img src="../Design/Icon/icon/back.png" class="control" />
                <asp:LinkButton ID="lbtback4" runat="server" OnClick="lbtback_Click">Trở Lại</asp:LinkButton>
            </div>
        </div>

    </div>
    <div id="pnControl" runat="server" visible="false">
        <div class="table">
            <img src="../Design/Icon/icon/page_save.png" class="control" />
            <asp:LinkButton ID="lbtSave5" runat="server" OnClick="lbtSaveMenu_Click">Lưu</asp:LinkButton>
            <img src="../Design/Icon/icon/moi.gif" class="control" />
            <asp:LinkButton ID="lbtdonew1" runat="server" OnClick="lbtDonew_Click">Làm mới</asp:LinkButton>
            <img src="../Design/Icon/icon/back.png" class="control" />
            <asp:LinkButton ID="lbtback5" runat="server" OnClick="lbtback_Click">Trở Lại</asp:LinkButton>
        </div>
        <div class="frame">
            <cc1:TabContainer ID="TabContainer1" runat="server" CssClass="NewsTab" ActiveTabIndex="0" Width="99%">
                <cc1:TabPanel runat="server" ID="tabmmenuinfo">
                    <HeaderTemplate>Thông tin Menu</HeaderTemplate>
                    <ContentTemplate>

                        <div class="rows">
                            <div class="ColLeft">
                                <span>Danh mục:</span>
                            </div>
                            <div class="ColRight">
                                <asp:DropDownList ID="ddlCategory" runat="server" CssClass="combobox">
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Loại Menu:</span>
                            </div>
                            <div class="ColRight">
                                <asp:DropDownList ID="ddlType" runat="server" CssClass="combobox" AutoPostBack="True" OnSelectedIndexChanged="ddlType_SelectedIndexChanged">
                                    <asp:ListItem Value="1">Menu Client</asp:ListItem>
                                    <asp:ListItem Value="2">Menu Admin</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Tên Menu:</span>
                            </div>
                            <div class="ColRight">
                                <input type="text" class="textbox" runat="server" id="txtName" />
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Menu Cha:</span>
                            </div>
                            <div class="ColRight">
                                <asp:DropDownList ID="ddlParent" runat="server" CssClass="combobox">
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Liên kết:</span>
                            </div>
                            <div class="ColRight">
                                <input type="text" class="textbox" runat="server" id="txtLink" />
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Kiểu liên kết:</span>
                            </div>
                            <div class="ColRight">
                                <asp:DropDownList ID="ddlTarget" runat="server" CssClass="combobox">
                                    <asp:ListItem Value="_self">_self</asp:ListItem>
                                    <asp:ListItem Value="_blank">_blank</asp:ListItem>
                                    <asp:ListItem Value="_top">_top</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Từ khóa:</span>
                            </div>
                            <div class="ColRight">
                                <input type="text" class="textbox" runat="server" id="txtKeyword" />
                            </div>
                        </div>
                        <div class="textarial">
                            <div class="ColLeft">
                                <span>Mô tả:</span>
                            </div>
                            <div class="ColRight">
                                <textarea id="txtDecription" runat="server" class="textarea2"></textarea>
                                &nbsp;
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Thứ tự:</span>
                            </div>
                            <div class="ColRight">
                                <input type="text" class="textbox" runat="server" id="txtOrd" />
                            </div>
                        </div>
                        <div class="rows">
                            <div class="ColLeft">
                                <span>Trạng thái:</span>
                            </div>
                            <div class="ColRight">
                                <input type="checkbox" runat="server" id="chkActive" />
                                &nbsp;&nbsp; &nbsp;
                            </div>
                        </div>
                    </ContentTemplate>
                </cc1:TabPanel>
                <cc1:TabPanel runat="server" ID="tabLanguageOther">
                    <HeaderTemplate>Ngôn Ngữ Khác</HeaderTemplate>
                    <ContentTemplate>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>

                                <div class="rows">
                                    <div class="ColLeft">
                                        <span>Ngôn ngữ:</span>
                                    </div>
                                    <div class="ColRight">
                                        <asp:DropDownList ID="ddlLanguage" runat="server" CssClass="combobox">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <div class="rows">
                                    <div class="ColLeft">
                                        <span>Tên Menu:</span>
                                    </div>
                                    <div class="ColRight">
                                        <input type="text" class="textbox" runat="server" id="txtNameValue" />
                                        &nbsp;&nbsp;
                                    </div>
                                </div>
                                <div class="rows">
                                    <div class="ColLeft">
                                        <span>Từ khóa:</span>
                                    </div>
                                    <div class="ColRight">
                                        <input type="text" class="textbox" runat="server" id="txtKeywordValue" />
                                        &nbsp;&nbsp;
                                    </div>
                                </div>
                                <div class="textarial">
                                    <div class="ColLeft">
                                        <span>Mô tả:</span>
                                    </div>
                                    <div class="ColRight">
                                        <textarea id="txtDecriptionValue" runat="server" class="textarea2"></textarea>
                                    </div>
                                </div>
                                <div class="clear"></div>
                                <div class="rows">
                                    <div class="ColLeft">
                                    </div>
                                    <div class="ColRight">
                                        <input type="button" class="button" runat="server" value="Thêm" id="btnThem" onserverclick="btnThemValue_Click" />

                                    </div>
                                </div>
                                <div class="clear"></div>
                                <div class="frame">
                                    <asp:GridView ID="grvNgonngu" runat="server" AutoGenerateColumns="False" BackColor="White"
                                        BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" Width="100%" AllowPaging="True"
                                        PageSize="20" ShowHeaderWhenEmpty="True" OnRowCommand="grvNgonngu_RowCommand">
                                        <Columns>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <input id="chkselectall" type="checkbox" runat="server" onclick="CheckAllLanguage(this);" />
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chkselect" runat="server" />
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="5%"></HeaderStyle>
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:TemplateField>
                                            <asp:TemplateField Visible="False">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblLanguageCode" runat="server" Text='<%#Eval("LanguageCode") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblLuanguage">Ngôn ngữ</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <span id="lblLuanguageCodes"><%#Utilities.Langguage.SelectLanguageName((List<RelaxLanguageDataContract>)Cache["Language"],Convert.ToInt32(Eval("Languagecode"))) %></span>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span id="lblName_Value">Tên</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblName_Values" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span>Từ Khóa</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblKeywordValue" runat="server" Text='<%#Eval("Keyword") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    <span>Mô tả</span>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:Label ID="lblDecriptionValue" runat="server" Text='<%#Eval("Decription") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <HeaderTemplate>
                                                    Thao tác
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ibtedit" runat="server" ToolTip='Sửa' CssClass="business" CommandName="cmd_edit"
                                                        CommandArgument='<%#Eval("Languagecode") %>' ImageUrl="../Design/Icon/icon/edit.png" />
                                                    <asp:ImageButton ID="ibtdel" runat="server" ToolTip='Xóa' CssClass="business" CommandName="cmd_delete"
                                                        CommandArgument='<%#Eval("Languagecode") %>' ImageUrl="../Design/Icon/icon/delete.png" />
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
                                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                            </asp:TemplateField>
                                        </Columns>
                                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                        <RowStyle BackColor="White" ForeColor="#003399" />
                                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                        <SortedAscendingCellStyle BackColor="#EDF6F6" />
                                        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                                        <SortedDescendingCellStyle BackColor="#D6DFDF" />
                                        <SortedDescendingHeaderStyle BackColor="#002876" />
                                    </asp:GridView>
                                </div>

                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </ContentTemplate>
                </cc1:TabPanel>
            </cc1:TabContainer>
        </div>
        <div class="table">
            <img src="../Design/Icon/icon/page_save.png" class="control" />
            <asp:LinkButton ID="lbtSave6" runat="server" OnClick="lbtSaveMenu_Click">Lưu</asp:LinkButton>
            <img src="../Design/Icon/icon/moi.gif" class="control" />
            <asp:LinkButton ID="lbtdonew2" runat="server" OnClick="lbtDonew_Click">Làm mới</asp:LinkButton>
            <img src="../Design/Icon/icon/back.png" class="control" />
            <asp:LinkButton ID="lbtback6" runat="server" OnClick="lbtback_Click">Trở Lại</asp:LinkButton>
        </div>
    </div>
</asp:Content>
